package com.swq.java.code.chapter16.code05;

public class ArrayBag<T> {
    //private T[] content=new T[10]; //编译出错，不能用泛型来创建数组实例
    private T[] content;

    public ArrayBag(T[] content) {
        this.content = content;
    }

    public T[] get() {
        return this.content;
    }

    public void set(T[] content) {
        this.content = content;
    }

    public static void main(String[] args) {

        String[] content = {"book1", "book2", "book3"};
        ArrayBag<String> bag = new ArrayBag<String>(content);

        for (String c : bag.get())
            System.out.println(c);
    }
}